<?php

class HexToRGBConverter {
	public static function pegaR($hexColor) {
		$map = HexToRGBConverter::explodeHex($hexColor);
		return hexdec($map['R']);
	}

	public static function pegaG($hexColor) {
		$map = HexToRGBConverter::explodeHex($hexColor);
		return hexdec($map['G']);
	}

	public static function pegaB($hexColor) {
		$map = HexToRGBConverter::explodeHex($hexColor);
		return hexdec($map['B']);
	}

	
	public static function explodeHex($hexColor) {
		$retorno = array();
		$retorno['R'] = substr($hexColor, 1, 2);
		$retorno['G'] = substr($hexColor, 3, 2);
		$retorno['B'] = substr($hexColor, 5, 2);
		
		return $retorno;
	}
}
?>